package com.ctshk.rpc.user.entity.es;

import com.ctshk.common.constant.ElasticSearchConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author 李新科
 * @date 2021/5/21 11:02
 */
@Document(indexName = ElasticSearchConstant.ORDER_INDEX)
@Data
@ApiModel(value="订单ES缓存实体", description="订单ES缓存实体")
public class OrderEs implements Serializable {

    @ApiModelProperty(value="id")
    @Id
    private Long id;

    @ApiModelProperty(value = "创建人")
    private Long createId;

    @ApiModelProperty(value = "订单编号")
    @Field(type = FieldType.Keyword)
    private String orderNumber;

    @ApiModelProperty(value="小店id,分销人")
    private Long shopId;

    @ApiModelProperty(value="类型,从SystemBusinessType类取值，1.2旅行团 6.7自由行 8.酒店 9.机票 10.火车票 11.船票 12.巴士票 13.机场快线 14.景点门票 15.当地玩乐 18.商品")
    private Integer type;

    @ApiModelProperty(value="类型,从SystemBusinessType类取值，1.2旅行团 6.7自由行 8.酒店 9.机票 10.火车票 11.船票 12.巴士票 13.机场快线 14.景点门票 15.当地玩乐 18.商品")
    @Field(type = FieldType.Text)
    private String typeName;

    @ApiModelProperty(value="币种id")
    private Long currencyId;

    @ApiModelProperty(value="币种")
    private String currency;

    @ApiModelProperty(value="订单总额")
    private BigDecimal orderAmount;

    @ApiModelProperty(value = "订单状态")
    private Integer orderStatus;

    @ApiModelProperty(value = "支付状态")
    private Integer paymentStatus;

    @ApiModelProperty(value = "预订状态")
    private Integer scheduledStatus;

    @ApiModelProperty(value = "退款状态")
    private Integer cancelStatus;

    @ApiModelProperty(value = "前端展示订单状态,取AppOrderStatus枚举值:1.待付款,2.您已下單，等待確認,3.已付款,4.待发货,5.已发货,6.待收货,7.待提货,8.预订失败,9.超时未付款,订单已取消,10.已完成,11.待处理,12.待退款,13.已退款")
    private Integer frontOrderStatus;

    @ApiModelProperty(value = "订单筛选状态,取AppFilterOrderStatus枚举值,1待付款，2已付款，3已取消，4已完成，5售后中")
    private Integer filterOrderStatus;

    @ApiModelProperty(value = "付款到期日期时间")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd HH:mm:ss")
    private LocalDateTime payExpireDateTime;

    @ApiModelProperty(value = "查询号码")
    @Field(type = FieldType.Keyword)
    private String queryNumber;

    @ApiModelProperty(value = "订单创建时间")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd HH:mm:ss")
    private LocalDateTime gmtCreate;

    @ApiModelProperty(value = "C端用户Id")
    private Long userId;

    @ApiModelProperty(value = "删除标识")
    private Integer isDeleted;

    @ApiModelProperty(value = "产品id")
    private Long productId;

    // 各单项公共字段↑

    // 各单项专属字段↓

    // 旅行团 start
    @ApiModelProperty(value = "旅行团-订单")
    @Field(type = FieldType.Nested)
    private TripOrderEs tripOrder;
    // 旅行团 end

    // 酒店 start
    @ApiModelProperty(value = "酒店-订单")
    @Field(type = FieldType.Nested)
    private HotelOrderEs hotelOrder;
    // 酒店 end

    // 机票 start
    @ApiModelProperty(value = "机票-订单")
    @Field(type = FieldType.Nested)
    private AirOrderEs airOrder;
    // 机票 end

    // 火车票 start
    @ApiModelProperty(value = "火车票-订单")
    @Field(type = FieldType.Nested)
    private TrainOrderEs trainOrder;
    // 火车票 end

    // 巴士票 start
    @ApiModelProperty(value = "巴士票-订单")
    @Field(type = FieldType.Nested)
    private BusOrderEs busOrder;
    // 巴士票 end

    // 船票 start
    @ApiModelProperty(value = "船票-订单")
    @Field(type = FieldType.Nested)
    private ShipOrderEs shipOrder;
    // 船票 end

    // 门票 start
    @ApiModelProperty(value = "门票-订单")
    @Field(type = FieldType.Nested)
    private ScenicOrderEs scenicOrder;
    // 门票 end

    // 自由行 start
    @ApiModelProperty(value = "自由行-订单")
    @Field(type = FieldType.Nested)
    private SeasonOrderEs seasonOrder;
    // 自由行 end

    // 当地玩乐 start
    @ApiModelProperty(value = "当地玩乐-订单")
    @Field(type = FieldType.Nested)
    private LocalFunOrderEs localFunOrder;
    // 当地玩乐 end

    // 商品 start
    @ApiModelProperty(value = "商品-订单")
    @Field(type = FieldType.Nested)
    private CommodityOrderEs commodityOrder;
    // 商品 end

    // 机场快线 start
    @ApiModelProperty(value = "机场快线-订单")
    @Field(type = FieldType.Nested)
    private AirportExpressOrderEs airportExpressOrder;
    // 机场快线 end
}
